package sky.demo.persistence.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import sky.demo.persistence.entity.Role;
import sky.demo.persistence.entity.User;

/**
 * @author sky
 */
public interface RoleDao extends BaseRepository<Role> {

    List<User> findByName(String name);

    @Query("from Role r join r.userRoleRels rel  where rel.user.id = :userId ")
    List<User> findByUserId(@Param("userId") String userId);

}
